package com.example.dubbo.storage.core.service;

import com.example.dubbo.storage.api.StorageService;
import com.example.dubbo.storage.core.dao.StorageMapper;
import com.example.dubbo.storage.core.dao.data.StorageDO;
import com.google.common.base.Preconditions;
import lombok.extern.slf4j.Slf4j;
//import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

@Slf4j
//@DubboService
public class StorageServiceImpl implements StorageService {

    @Resource
    private StorageMapper storageMapper;

    @Override
    public void deduct(String commodityCode, int count) {
        /*

        StorageDO storageDO = storageMapper.getByCommodityCode(commodityCode);
        Preconditions.checkArgument(storageDO != null, "");
        // 扣减库存
        int i = storageMapper.deductById(storageDO.getId(), count);
        log.info("扣减库存，commodityCode={}, count={}, i={}", commodityCode, count, i);
         */
    }
}
